import pymysql

con = pymysql.connect(host="localhost",user="root",password="123456",database="spider")
# 获取游标
cursor = con.cursor()
sql = "delete from users where name=%s"
# 执行语句
row = cursor.execute(sql,"张三")
print(row)
# 提交
con.commit()
# 关闭
cursor.close()
con.close()